package com.mc.jf.entity;

import java.util.List;

public class ResUtil {//code=0 操作成功
    public static HttpResponse ok(Object data){
        return ok(0,"操作成功",data);
    }

    public static HttpResponse ok(Object data,String msg){
        return ok(0,msg,data);
    }

    public static HttpResponse ok(int code,String msg,Object data){
        HttpResponse response=new HttpResponse();
        response.setCode(code);
        response.setMsg(msg);
        response.setData(data);
        return response;
    }
    public static HttpResponse error(String msg){
        return error(-1,msg,null);
    }

    public static HttpResponse error(Object data,String msg){
        return error(-1,msg,data);
    }
    public static HttpResponse error(int code,String msg,Object data){
        HttpResponse response=new HttpResponse();
        response.setCode(code);
        response.setMsg(msg);
        response.setData(data);
        return response;
    }

    public static HttpListResponse list(Long count,Object data){
        HttpListResponse response=new HttpListResponse();
        response.setCode(0);
        response.setMsg("操作成功");
        response.setCount(count);
        response.setData(data);
        return response;
    }



}
